package com.example.peibei.ui.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.HomeCateTwo;
import com.dingtao.common.bean.Order;
import com.dingtao.common.bean.RecommendMember;
import com.dingtao.common.util.GlideUtils;
import com.example.peibei.R;

import java.util.List;

public class RecommendMemberAdapter extends BaseQuickAdapter<Order.RecordsDTO, BaseViewHolder> {
    public RecommendMemberAdapter(@Nullable List<Order.RecordsDTO> data) {
        super(R.layout.item_recommend_member, data);
    }

    public RecommendMemberAdapter() {
        super(R.layout.item_recommend_member);
    }

    @Override
    protected void convert(BaseViewHolder helper, Order.RecordsDTO item) {
        helper.setText(R.id.tv_cate, item.getCategory()).setText(R.id.tv_price, item.getPrice());
        ImageView head = helper.getView(R.id.iv_cate);
        if (!TextUtils.isEmpty(item.getImgUrl())) {
            Glide.with(getContext()).load(item.getImgUrl()).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(head);
        } else {
            helper.setImageResource(R.id.iv_cate, R.mipmap.cate_defalut);
        }
    }
}
